<?php

namespace App\Http\Requests\Admin\Login;

use Illuminate\Foundation\Http\FormRequest;

class ResetPassword extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * 定义表单验证规则
     *
     * @return array
     */
    public function rules()
    {
        return [
            'old_password' => 'required|alpha_num|min:6|max:18',
            'new_password' => 'required|alpha_num|min:6|max:18',
        ];
    }

    /**
     * 定义表单验证提示信息
     *
     * Date: 2018/06/01
     * @author Tenny
     * @return array
     */
    public function messages()
    {
        return [
            'old_password.required' => '请输入密码',
            'old_password.alpha_num' => '旧密码只能是英文字母或数字',
            'old_password.min' => '旧密码不得少于:min个字符',
            'old_password.max' => '旧密码不得超过:max个字符',
            'new_password.required' => '请输入密码',
            'new_password.alpha_num' => '新密码只能是英文字母或数字',
            'new_password.min' => '新密码不得少于:min个字符',
            'new_password.max' => '新密码不得超过:max个字符',
        ];
    }
}
